package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.controller.dto.AuthorDto;
import com.example.demo.entity.Goods;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface GoodsMapper extends BaseMapper<Goods> {
    List<Goods> findByUserId(@Param("userId") Integer userId);
    
    @Select("select count(id) count, author from goods GROUP BY author")
    List<AuthorDto> countAuthor();
    
    //按照商户匹配
    List<Goods> findByBusId(@Param("busId") Integer busId);
}
